import React from "react"
import {Divider, Popconfirm, Popover, Tooltip} from "antd"
import {HOST} from "../../../../shared/project-config";


const columns = ({onDel, onView}) => [
  {
    title: '服装编号',
    dataIndex: 'clothingCode',
    key: 'clothingCode',
    width: 150,
    render: (i, row) => {
      return <a onClick={() => onView(row)}>{i}</a>
    }
  }, {
    title: '图片',
    dataIndex: 'pictures',
    key: 'pictures',
    render: (d, row) => {
      return (
        <div className={'favorite-thumb'}>
          {
            d.map(p =>
              <Popover overlayClassName={'favorite-img-box'}
                       content={<div><img src={`${HOST}/file/image/${p.id}`}/></div>}>
                <img src={`${HOST}/file/thumb/${p.id}`}/>
              </Popover>
            )
          }
        </div>
      )
    }
  }, {
    title: '收藏时间',
    dataIndex: 'createTime',
    width: 200,
    key: 'createTime',
  }, {
    title: '操作',
    width: 150,
    key: 'action',
    render: (a, row) => {
      return (
        <div>
          <div>
            <a onClick={() => onView(row)}>查看</a>

            <Divider type="vertical"/>

            <Popconfirm title={<div>确认删除<b className={'line-stress'}>{row.code}</b>吗?</div>}
                        onConfirm={() => onDel(row)}>
              <a>删除</a>
            </Popconfirm>
          </div>
        </div>
      )
    }
  }]

export default columns